package com.qezhhnjy.flink.mapper;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.util.Collector;

/**
 * @author zhaoyangfu
 * @date 2021/8/24-16:07
 */
public class MyFlatMapper implements FlatMapFunction<String, Tuple2<String, Integer>> {

    @Override
    public void flatMap(String value, Collector<Tuple2<String, Integer>> collector) throws Exception {
        for (String word : value.split("")) {
            collector.collect(new Tuple2<>(word, 1));
        }
    }
}
